import 'package:auto_route/auto_route.dart';
import 'package:flutter_news/common/router/router.dart';
import 'package:flutter_news/common/utils/utils.dart';

class AuthGuard extends AutoRouteGuard  {

  @override
  void onNavigation(NavigationResolver resolver, StackRouter router) async{
    var isAuth = await isAuthenticated();
    if (isAuth == false) {
      // 授权失败
      resolver.redirect(SignUpRoute());
    } else {
      // 授权通过
      resolver.next(true);
    }
  }


}
